style fixes
authorJoonas Koivunen <joonas.koivunen@gmail.com>
Fri, 14 Apr 2017 07:55:26 +0000 (10:55 +0300)
committerJoonas Koivunen <joonas.koivunen@gmail.com>
Fri, 14 Apr 2017 07:55:26 +0000 (10:55 +0300)
src/cargo/sources/git/utils.rs
tests/git.rs

index 26fbc917edab2664eda7559437825d94ad1a1b76..464ca73f34823ef13860dff47b4837b7a72cf304 100644 (file)
@@ -294,16 +294,17 @@ impl<'a> GitCheckout<'a> {
             info!("update submodules for: {:?}", repo.workdir().unwrap());
 
             for mut child in repo.submodules()?.into_iter() {
-                update_submodule(repo, &mut child, cargo_config).chain_error(||
-                    human(
-                        format!("Failed to update submodule `{}`",
-                            child.name().unwrap_or("")))
-                    )?;
+                update_submodule(repo, &mut child, cargo_config).chain_error(|| {
+                    human(format!("Failed to update submodule `{}`",
+                                  child.name().unwrap_or("")))
+                })?;
             }
             Ok(())
         }
 
-        fn update_submodule(parent: &git2::Repository, child: &mut git2::Submodule, cargo_config: &Config) -> CargoResult<()> {
+        fn update_submodule(parent: &git2::Repository,
+                            child: &mut git2::Submodule,
+                            cargo_config: &Config) -> CargoResult<()> {
             child.init(false)?;
             let url = child.url().chain_error(|| {
                 internal("non-utf8 url for submodule")
index 43066847abc874c85c934246ac402599ff76465f..71418775de8fcda8925d0c07278cd8a038ef5afe 100644 (file)
@@ -777,7 +777,13 @@ fn dep_with_bad_submodule() {
     let repo = git2::Repository::open(&git_project2.root()).unwrap();
     let original_submodule_ref = repo.refname_to_id("refs/heads/master").unwrap();
     let commit = repo.find_commit(original_submodule_ref).unwrap();
-    commit.amend(Some("refs/heads/master"), None, None, None, Some("something something"), None).unwrap();
+    commit.amend(
+        Some("refs/heads/master"),
+        None,
+        None,
+        None,
+        Some("something something"),
+        None).unwrap();
 
     let project = project
         .file("Cargo.toml", &format!(r#"
@@ -796,8 +802,7 @@ fn dep_with_bad_submodule() {
             pub fn foo() { dep1::dep() }
         ");
 
-    assert_that(project.cargo_process("build"),
-                execs().with_stderr(format!("\
+    let expected = format!("\
 [UPDATING] git repository [..]
 [ERROR] failed to load source for a dependency on `dep1`
 
@@ -807,7 +812,10 @@ Caused by:
 Caused by:
   Failed to update submodule `src`
 
-To learn more, run the command again with --verbose.\n", path2url(git_project.root()))).with_status(101));
+To learn more, run the command again with --verbose.\n", path2url(git_project.root()));
+
+    assert_that(project.cargo_process("build"),
+                execs().with_stderr(expected).with_status(101));
 }
 
 #[test]